package Tools;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
 * This class contains  methods "static void main(String[] a)"
 * @author Ivan
 *
 */
public class FilesManager {
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		TBrowser browser = new TBrowser();
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		
		try{
			System.out.print("Select Mode :" + "\n" 
		                      + "   (1) Show files in directory ;" + "\n" 
			                  + "   (2) Show Tree of directories and files;" + "\n"
					          + "   (3) Show files in directory with exteded information and pre-specified mask of search." + "\n");
			
			int mode  = Integer.parseInt(reader.readLine());
			
			switch (mode) {
			case 1:
				System.out.print("directory : ");
				browser.ShowFiles(reader.readLine());
				break;
				
			case 2:
				System.out.print("directory : ");
				browser.ShowTreeOfDirectories(reader.readLine());
				break;
				
			case 3:
				String dir, mask;
				
				System.out.print("directory : ");
				dir = reader.readLine();
				
				System.out.print("mask of search : ");
				mask = reader.readLine();
				
				browser.ShowFiles(dir, new MaskCaseSensitive(mask));
				break;
			default:
				reader.close();
				break;
			}		        
		   
		}
        catch(IOException e){
        	System.out.print("Error of read! "+ e.getMessage());
		}
		catch(NumberFormatException e){
			System.out.print("Error select mode!  "+ e.getMessage());
		}
	
	}

}
